package oj;

// write your code here

import java.util.Scanner;

public class Day32F {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int y1 = sc.nextInt();
            int m1 = sc.nextInt();
            int d1 = sc.nextInt();
            int y2 = sc.nextInt();
            int m2 = sc.nextInt();
            int d2 = sc.nextInt();
            int profit = 0;
            profit = profitYear(y1) - profitIsThisYear(y1, m1, d1 - 1);
            profit += profitIsThisYear(y2, m2, d2);
            if (y1 == y2) {
                profit -= profitYear(y1);
            }
            for (int i = y1 + 1; i < y2; i++) {
                profit += profitYear(i);
            }
            System.out.println(profit);
        }
    }


    private static int profitIsThisYear(int year, int month, int day) {
        int profit = 0;
        if (!isPrime(month)) {
            profit = 2 * day;
        } else {
            profit = day;
        }
        while (--month > 0) {
            switch (month) {
                case 1:
                case 8:
                case 10:
                case 12:
                    profit += 62;
                    break;
                case 3:
                case 5:
                case 7:
                    profit += 31;
                    break;
                case 4:
                case 6:
                case 9:
                    profit += 60;
                    break;
                case 11:
                    profit += 30;
                    break;
                default:
                    profit += (28 + (isLeapYear(year) ? 1 : 0));
                    break;
            }
        }
        return profit;
    }
        private static int profitYear(int year){
            return 2 * 31
                    + 1 * 28
                    + 1 * 31
                    + 2 * 30
                    + 1 * 31
                    + 2 * 30
                    + 1 * 31
                    + 2 * 31
                    + 2 * 30
                    + 2 * 31
                    + 1 * 30
                    + 2 * 31
                    + (isLeapYear(year) ? 1 : 0);
        }


        private static boolean isLeapYear ( int year){
            return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
        }

        private static boolean isPrime ( int month){
            return month == 2 ||  month==3 || month == 5 || month == 7 || month == 11;
        }
    }
